<?php


/**
* Puree CMS
* http://www.molotsoft.ru
*
* @package Puree_CMS
* @subpackage Admin/Views
* @author Ivan Chistyakov <ivan@molotsoft.ru>
* @version $Id: automate.php 1136 2010-03-25 19:42:17Z molotsoft@gmail.com $
* @link $HeadURL: http://puree-cms.googlecode.com/svn/trunk/plugins/admin/views/automate.php $
*/


class AutomateView extends View {

/******************************************************************************/

function controllerElement($name, $params = array(), $loadHelpers = FALSE) {
	$element = parent::element($this->params['controller'] . DS . $name, $params, $loadHelpers);
	if (!(bool)$element || (bool)preg_match('~^Not Found\: ~i', $element)) {
		$element = parent::element('automate' . DS . $name, $params, $loadHelpers);
	}
	return $element;
}

function _getViewFileName($name = NULL) {
	$filename = parent::_getViewFileName($name);
	if (!is_file($filename)) {
		$buffer = $this->viewPath;
		$this->viewPath = 'automate';
		$filename = parent::_getViewFileName($name);
		$this->viewPath = $buffer;
	}
	return $filename;
}

function _missingView($file, $error = 'missingView') {
	if ($this->viewPath === 'automate') {
		return parent::_missingView($file, $error);
	}
	return FALSE;
}

function _paths($plugin = NULL, $cached = TRUE) {
	if (empty($plugin)) {
		$plugin = 'admin';
	}
	$paths = parent::_paths($plugin, $cached);
	if (empty($this->__paths)) {
		$this->__paths = $paths;
	}
	return $paths;
}

/******************************************************************************/

}


?>